package org.bite.lesson02;
import java.security.KeyStore;

public class Demo_202 {
    public static void main(String[] args) throws Exception {
        Thread t1 = new Thread(()->{
            while(true){
                System.out.println(Thread.currentThread().getName() + " hello...");
                try{
                    Thread.sleep(1000);
                }catch(InterruptedException e){
                    e.printStackTrace();
                }
            }
        });
        t1.start();
        Thread t2 = new Thread(()->{
            // 获取类名
            String cName = Demo_202.class.getName();
            // 获取当前执行的方法名
            String mName = Thread.currentThread().getStackTrace()[1].getMethodName();
            // 获取线程对象
            Thread thread = Thread.currentThread();
            // 获取线程名
            String tName = thread.getName();
            while(true){
                System.out.println("当前类：" + cName + ", 当前方法：" + mName + ", 当前线程：" + tName);
                try{
                    Thread.sleep(1000);
                }catch(InterruptedException e){
                    e.printStackTrace();
                }
            }

        },"kiku线程");

        t2.start();
    }
}
